<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>管理员添加</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
</head>
<body>

<form class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">

    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="adm_username" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">登录密码</label>
        <div class="layui-input-block">
            <input type="password" name="adm_password" lay-verify="required" placeholder="请输入用户密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-block">
            <input type="text" name="adm_realname" lay-verify="required" placeholder="用户姓名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机</label>
        <div class="layui-input-block">
            <input type="text" name="adm_mobile" lay-verify="phone" placeholder="请输入号码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">邮箱</label>
        <div class="layui-input-block">
            <input type="text" name="adm_email"  placeholder="请输入邮箱" autocomplete="off" class="layui-input">
        </div>
    </div>


    {if $isFromInstitutionList}
    <div class="layui-form-item">
        <label class="layui-form-label">角色</label>
        <div class="layui-input-block">
            <select name="adm_role_id" lay-filter="roleList">
                <option value="{$institutionRoleInfo['rol_id']}">{$institutionRoleInfo['rol_name']}</option>
            </select>
        </div>
    </div>
    {else/}
    <div class="layui-form-item">
        <label class="layui-form-label">角色</label>
        <div class="layui-input-block">
            <select name="adm_role_id" lay-filter="roleList">
                {volist name="roleList" id="vo"}
                <option value="{$vo['rol_id']}">{$vo['rol_name']}</option>
                {/volist}
            </select>
        </div>
    </div>
    {/if}
    <div class="layui-form-item" style="{if $isFromInstitutionList==false}display: none;{/if}" id="institutionName">
        <label class="layui-form-label">机构名称</label>
        <div class="layui-input-block">
            <input type="text" name="ins_name" placeholder="请输入该管理员所管理的培训机构名称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" style="{if $isFromInstitutionList==false}display: none;{/if};" id="city">
        <label class="layui-form-label">所处城市</label>
        <div class="layui-input-block">
            <select name="cty_id" >
                {volist name="cityList" id="vo"}
                <option value="{$vo['cty_id']}">{$vo['cty_name']}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">审核状态</label>
        <div class="layui-input-inline">
            <input type="checkbox" lay-filter="switch" name="adm_status" lay-skin="switch" lay-text="通过|待审核">
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <button class="layui-btn" lay-submit lay-filter="LAY-admin-add-submit" id="LAY-admin-add-submit">提交</button>
    </div>
</form>

<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form'], function(){
        var $ = layui.$
            ,form = layui.form ;
        form.on('select(roleList)', function(data){
            let roleIdOfInstitution="{$roleIdOfInstitution}";
            if(data.value==roleIdOfInstitution){
                $("#institutionName").css("display","block");
                $("#city").css("display","block");
            }else{
                $("#institutionName").css("display","none");
                $("#city").css("display","none");
            }
        })
    })
</script>
</body>
</html>
